package com.example.grade;
import java.util.Scanner;
public class StudentGrade {

    private String studentName;
    private String studentId;
    private String courseName;
    private int grade;

    public StudentGrade(String studentName, String studentId, String courseName, int grade) {
        this.studentName = studentName;
        this.studentId = studentId;
        this.courseName = courseName;
        this.grade = grade;
    }

    public String getStudentName() {
        return studentName;
    }

    public String getStudentId() {
        return studentId;
    }

    public String getCourseName() {
        return courseName;
    }

    public int getGrade() {
        return grade;
    }

    @Override
    public String toString() {
        return String.format("姓名:%s，学号:%s,课程:%s,成绩:%d", studentName, studentId, courseName, grade);
    }

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("\n===== 记录学生成绩 =====");
        System.out.print("请输入学生姓名:");
        String studentName = input.nextLine();
        System.out.print("请输入学生的学号:");
        String studentId = input.nextLine();
        System.out.print("请输入课程名称:");
        String courseName = input.nextLine();
        System.out.print("请输入成绩（0-100）:");
        int grade = input.nextInt();
        input.nextLine();
        StudentGrade studentGrade = new StudentGrade(studentName, studentId, courseName, grade);
        System.out.println(studentGrade);
    }
}